package exercise;

import java.util.Date;

/**
 * @classname:DateTest
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/9 21:53
 * @version: 0.1
 * @since:1.8
 */
public class DateTest {
    public static void main(String[] args) {
        String[] dateStr = {
                "2020-12-12 12-12-12",
                "2020-12-12 12-12-12",
                "2020-12-12 12-12-12",
                "2020-12-12 12-12-12",
                "2020-12-12 12-12-12",
                "2020-12-12 12-12-12"
        };


        //实在多线程的环境下会出现问题
        new Thread(() -> {
            for (String s : dateStr) {
                Date date = DateUtil.strConvertToDate(s);
                System.out.println(Thread.currentThread().getName() + date);
            }
        }).start();


        new Thread(()->{
            for (String s : dateStr) {
                Date date = DateUtil.strConvertToDate(s);
                System.out.println(Thread.currentThread().getName()+date);
            }
        }).start();
    }
}
